package homework3;

public class Student {
	private String name;
	private int age;
	private float sorce;

	public Student() {
	}

	public Student(String name, int age, float sorce) {
		this.name = name;
		this.age = age;
		this.sorce = sorce;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public float getSorce() {
		return sorce;
	}

	@Override
	public String toString() {
		return "Student{" + "name='" + name + '\'' + ", age=" + age + ", sorce=" + sorce + '}';
	}

	public void setSorce(float sorce) {
		this.sorce = sorce;
	}

	public int compareTo(Student o) {

		int result = (int) (o.getSorce() - this.getSorce());
		if (result == 0) {
			result = o.getAge() - this.getAge();
		}
		return result;

	}
}
